import {link} from '@/api/api.js'
export let home={
	state: {
		  kind:[],
		  tuijian:[],
		  hot:[]
		  // detail:[]
	},
	mutations: {
		  upkind(state,payload){
			  state.kind = payload
		  },
		  uptuijian(state,payload){
			  state.tuijian = payload
		  },
		  uphot(state,payload){
		  		  state.hot = payload
		  },
		  // updetail(state,payload){
		  // 		  state.detail = payload
		  // },
	},
	actions: {
		  homeaxios(content){
			  link("/home","get").then(ok=>{
				  // console.log(ok.data.kind)
				  content.commit("upkind",ok.data.kind)
			  }).catch(err=>{
				  console.log(err)
			  }),
			  link("/tuijian","get").then(ok=>{
			  			  // console.log(ok.data.tuijian)
			  			  content.commit("uptuijian",ok.data.tuijian)
			  }).catch(err=>{
			  			  console.log(err)
			  }),
			  link("/hot","get").then(ok=>{
			  			  // console.log(ok.data.hot)
			  			  content.commit("uphot",ok.data.hot)
			  }).catch(err=>{
			  			  console.log(err)
			  })
			  // link("/hot","get").then(ok=>{
			  // 			  // console.log(ok.data.detail[0].value)
			  // 			  content.commit("updetail",ok.data.detail)
			  // }).catch(err=>{
			  // 			  console.log(err)
			  // })
			  
		  }
		  
	}
}